<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <!--el 表达式 ${} // 请求域取值-->
    <title th:text="${title}">Title</title>
    <style>
        hr{
            margin: 10px 0;
        }
        .bgcr{
            background-color: #ee0000;
        }
        .bgcg{
            background-color: #00ee00;
        }
    </style>
</head>
<body>
<div>
    <!--文本替换-->
    <div th:text="欢迎使用Thymleaf模板">
        文本替换
    </div>
    <hr/>
    <!--支持html的文本替换-->
    <div th:utext="${h}">
        &lt;h1&gt;李同学&lt;/h1&gt;
    </div>
    <hr/>
    姓名：<input type="text" th:value="${name}" value="孙岩">
    <hr/>
    <div>
        员工信息：<br/>
        姓名：<span th:text="${e.empName}"></span><br/>
        性别：<span th:text="${e.getGender()}"></span><br/>
        邮箱：<span th:text="${e.email == null?'未知':e.email}"></span><br/>
        部门：<span th:text="${e.department.deptName}"></span><br/>
    </div>
    <div th:object="${e}">
        员工信息：<br/>
        姓名：<span th:text="*{empName}"></span><br/>
        性别：<span th:text="*{getGender()}"></span><br/>
        邮箱：<span th:text="*{email}"></span><br/>
        部门：<span th:text="*{department.deptName}"></span>
    </div>

    <!--条件判断-->
    <div th:if="${flag}">
        <p>春眠不觉晓，处处闻啼鸟。</p>
    </div>
    <div th:unless="${flag}">
        <p>夜来风雨声，花落知多少。</p>
    </div>
    <hr/>
    <table>
        <thead>
        <tr>
            <th>序号</th>
            <th>姓名</th>
        </tr>
        </thead>
        <tbody th:if="${list == null || list.size()<1}">
        <tr>
            <td style="column-span: 2;">无数据</td>
        </tr>
        </tbody>
        <tbody th:unless="${list == null || list.size()<1}">
        <tr th:each="e, state : ${list}" th:class="${state.odd}?'bgcr':'bgcg'">
            <td th:text="${state.count}"></td>
            <td th:text="${e.empName}"></td>
        </tr>
        </tbody>
    </table>

</div>
</body>
</html>